package com.bs.utils;

public class DataColumn {
    private DataTable table; // dataTable的引用
    private String columnName; // 列名
    private String captionName; // 显示名称
    private String dataType;// 列数据类型
    private int columnIndex;// 列索引
    private Object tag;// //通过tag对象保存公式配置
    private boolean readOnly; // 只读
    private boolean isDisplayed = true; // 是否显示

    public DataColumn() {
        this("Column1");
    }

    public DataColumn(String columnName) {
        this(columnName, "S");
    }

    public DataColumn(String columnName, String dataType) {
        this.setDataType(dataType);
        this.columnName = columnName;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public void setTable(DataTable table) {
        this.table = table;
    }

    public String getColumnName() {
        return this.columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
        if (captionName.isEmpty()) captionName = columnName;
    }

    public String getCaptionName() {
        return captionName;
    }

    public void setCaptionName(String captionName) {
        this.captionName = captionName;
    }

    public boolean isReadOnly() {
        return this.readOnly;
    }

    public void setReadOnly(boolean readOnly) {
        this.readOnly = readOnly;
    }

    public DataTable getTable() {
        return this.table;
    }

    public String getDataType() {
        return dataType;
    }

    public void setColumnIndex(int columnIndex) {
        this.columnIndex = columnIndex;
    }

    public int getColumnIndex() {
        return columnIndex;
    }

    //功能描述： 将输入数据转为当前列的数据类型返回
    public Object convertTo(Object value) {
        return value;
    }

    @Override
    public String toString() {
        return this.columnName;
    }

    public void setTag(Object tag) {
        this.tag = tag;
    }

    public Object getTag() {
        return tag;
    }

    public boolean isDisplayed() {
        return isDisplayed;
    }

    public void setDisplayed(boolean isDisplayed) {
        this.isDisplayed = isDisplayed;
    }

}
